package org.komarichin.struts2.actions.news;

import org.komarichin.jpa.entity.INews;
import org.komarichin.jpa.entity.News;
import org.komarichin.jpa.service.INewsService;
import org.komarichin.struts2.BaseAction;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

/**
 * Created by IntelliJ IDEA.
 * User: Admin
 * Date: 24.09.2009
 * Time: 13:22:11
 */
public class NewsAction extends BaseAction {
    @Autowired
    private INewsService newsService;
    @Autowired
    private INews news;
    private static final long serialVersionUID = -133731749260879038L;

    public String save() throws Exception {
        newsService.save(news);
        return SUCCESS;
    }

    public String update() throws Exception {
        return SUCCESS;
    }

    public INews getNews() {
        return news;
    }

    public void setNews(News news) {
        this.news = news;
    }

    public List<INews> getAllNews() {
        return newsService.getAll();
    }

    public INewsService getNewsService() {
        return newsService;
    }

    public void setNewsService(INewsService newsService) {
        this.newsService = newsService;
    }
}
